/**
 * @Author: 小狐
 * @Date: 2021/11/26 17:13
 * @Describe 主动去学习
 *
 */
package service

import (
	"cinema/dao"
	"context"
	"dubbo_maoyan/api/api"
	"fmt"
)

type CinemaProvider struct {
	api.UnimplementedCinemaServer
}

func (c *CinemaProvider) GetCinemaList(ctx context.Context, request *api.RegionRequest) (*api.CinemaListResponse, error) {

	cinemaList := dao.CinemaDao.GetCinemaList(ctx, request)
	//跳过判断是否有没有
	//数据转换
	var cinemaListResponse *api.CinemaListResponse
	for _, cinema := range cinemaList {
		fmt.Println("输出获取到影院的值", cinema)
		response := &api.CinemaResponse{
			CinemaName: cinema.CinemaName,
			CinemaId:   cinema.CinemaId,
			Remark:     cinema.Remark,
		}
		cinemaListResponse.CinemaResponse = append(cinemaListResponse.CinemaResponse, response)
	}
	return cinemaListResponse, nil
}
